package jianzhiOffer;

public class num57 {
    public int[] twoSum(int[] nums, int target) {
        int l = 0;
        int r = nums.length - 1;
        while(l < r) {
            if(nums[l] + nums[r] < target) {
                l ++;
            }else if(nums[l] + nums[r] > target) {
                r --;
            }else {
                return new int[]{nums[l],nums[r]};
            }
        }
        return new int[0];
    }
}
